﻿delete from PulsatrixStagingDb.dbo.VstupDb_SpecialitySubject;
delete from PulsatrixStagingDb.dbo.VstupDb_Speciality;
delete from PulsatrixStagingDb.dbo.VstupDb_Faculty;
delete from PulsatrixStagingDb.dbo.VstupDb_University;
delete from PulsatrixStagingDb.dbo.VstupDb_UniversityType;
delete from PulsatrixStagingDb.dbo.VstupDb_Subject;
delete from PulsatrixStagingDb.dbo.VstupDb_Region;
delete from PulsatrixStagingDb.dbo.VstupDb_ExpandedSpecialization;
delete from PulsatrixStagingDb.dbo.VstupDb_Specialization;
delete from PulsatrixStagingDb.dbo.VstupDb_EducationForm;
delete from PulsatrixStagingDb.dbo.VstupDb_Direction;
delete from PulsatrixStagingDb.dbo.VstupDb_DirectionType;
delete from PulsatrixStagingDb.dbo.VstupDb_Branch;
delete from PulsatrixStagingDb.dbo.VstupDb_EducationalQualifications;
delete from PulsatrixStagingDb.dbo.VstupDb_EducationalQualificationsGroup;
delete from PulsatrixStagingDb.dbo.VstupDb_Year;


insert into PulsatrixStagingDb.dbo.VstupDb_Year (YearId, Value)
select YearId, Value
from VstupDb.dbo.Year;
insert into PulsatrixStagingDb.dbo.VstupDb_EducationalQualificationsGroup (EducationalQualificationsGroupId, Name)
select EducationalQualificationsGroupId, Name
from VstupDb.dbo.EducationalQualificationsGroup;
insert into PulsatrixStagingDb.dbo.VstupDb_EducationalQualifications (EducationalQualificationsId, Name, EducationalQualificationsGroupId, YearId)
select EducationalQualificationsId, Name, EducationalQualificationsGroupId, YearId
from VstupDb.dbo.EducationalQualifications;
insert into PulsatrixStagingDb.dbo.VstupDb_Branch (BranchId, EducationalQualificationsGroupId, Name, YearId)
select BranchId, EducationalQualificationsGroupId, Name, YearId
from VstupDb.dbo.Branch;
insert into PulsatrixStagingDb.dbo.VstupDb_DirectionType (DirectionTypeId, Name)
select DirectionTypeId, Name
from VstupDb.dbo.DirectionType;
insert into PulsatrixStagingDb.dbo.VstupDb_Direction (DirectionId, Name, BranchId, YearId, Code, DirectionTypeId)
select DirectionId, Name, BranchId, YearId, Code, DirectionTypeId
from VstupDb.dbo.Direction;
insert into PulsatrixStagingDb.dbo.VstupDb_EducationForm (EducationFormId, Name)
select EducationFormId, Name
from VstupDb.dbo.EducationForm;
insert into PulsatrixStagingDb.dbo.VstupDb_Specialization (SpecializationId, Name, BranchId, YearId, Code)
select SpecializationId, Name, BranchId, YearId, Code
from VstupDb.dbo.Specialization;
insert into PulsatrixStagingDb.dbo.VstupDb_ExpandedSpecialization (ExpandedSpecializationId, Name, YearId, DirectionId, SpecializationId, BranchId)
select ExpandedSpecializationId, Name, YearId, DirectionId, SpecializationId, BranchId
from VstupDb.dbo.ExpandedSpecialization;
insert into PulsatrixStagingDb.dbo.VstupDb_Region (RegionId, Name)
select RegionId, Name
from VstupDb.dbo.Region;
insert into PulsatrixStagingDb.dbo.VstupDb_Subject (SubjectId, Name, YearId)
select SubjectId, Name, YearId
from VstupDb.dbo.Subject;
insert into PulsatrixStagingDb.dbo.VstupDb_UniversityType (UniversityTypeId, Name)
select UniversityTypeId, Name
from VstupDb.dbo.UniversityType;
insert into PulsatrixStagingDb.dbo.VstupDb_University (UniversityId, Name, UniversityTypeId, PostIndex, Address, Phones, Site, Mail, YearId, RegionId)
select UniversityId, Name, UniversityTypeId, PostIndex, Address, Phones, Site, Mail, YearId, RegionId
from VstupDb.dbo.University;
insert into PulsatrixStagingDb.dbo.VstupDb_Faculty (FacultyId, Name, UniversityId, YearId)
select FacultyId, Name, UniversityId, YearId
from VstupDb.dbo.Faculty;
insert into PulsatrixStagingDb.dbo.VstupDb_Speciality (SpecialityId, FacultyId, DirectionId, SpecializationId, EducationalQualificationsId, YearId, EducationFormId, ExpandedSpecializationId, Budjet, License, VstupId)
select SpecialityId, FacultyId, DirectionId, SpecializationId, EducationalQualificationsId, YearId, EducationFormId, ExpandedSpecializationId, Budjet, License, VstupId
from VstupDb.dbo.Speciality;
insert into PulsatrixStagingDb.dbo.VstupDb_SpecialitySubject (SpecialitySubjectId, SpecialityId, SubjectId, IsProfile)
select SpecialitySubjectId, SpecialityId, SubjectId, IsProfile
from VstupDb.dbo.SpecialitySubject;
